package org.kukker.gesture;

import org.kukker.list.KukkerListItemView;
import org.kukker.list.KukkerListView;

import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * 6. single tap normal-press release  = change focus to the view item.
 * @author asantoso
 *
 */
public class G6{
	public boolean mActionDown;
	public View mView;
	public G6(View aView){
		this.mView = aView;
	}
	
	
	
	/**
	 * Detect motion event
	 * @param event
	 * @return 2 dimension boolean array, 
	 * 1st value indicates if the event must stop propagate. 
	 * 2nd value indicates if the gesture is recognized
	 */
	public boolean[] detect(MotionEvent event){		
		 int action = event.getAction();
		 String actionName = org.kukker.Util.kMotionEvent.getActionName(event);
		 
		 Log.i("eventflow1",
	    			"["+this.getClass().getSimpleName()+"]" 
	    				    			    			
	    			+"["
	    			+"onTouchEvent()"
	    			+", actionName:"+actionName
	    			
	    			+"]"    			
			 );
		 
			if (action == MotionEvent.ACTION_DOWN) {
				mActionDown = true;
				return new boolean[]{true,false};
			}
			else if (mActionDown && action == MotionEvent.ACTION_UP) {			
					mActionDown = false;
				return new boolean[]{true,true};
			}			
			else if (action == MotionEvent.ACTION_CANCEL){
				mActionDown = false;			
				return new boolean[]{true,false};
			}
			return new boolean[]{false,false};	
	}	
}